package com.zhang.modules.mianShi.rep;

import com.zhang.common.jpa.rep.BaseRep;
import com.zhang.modules.mianShi.entity.Region;
import com.zhang.modules.mianShi.entity.dto.region.RegionDto;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RegionRep extends BaseRep<Region,String> {



    @Query(value = "select * from app_region where machine_group_id = ?1 and deleted = false",nativeQuery = true)
    Page<Region> findAllByMachineId(String machineId, Pageable pageable);

    @Query(value = "select id as id,region_name as regionName from app_region where machine_group_id = ?1 and deleted = false  ",nativeQuery = true)
    List<RegionDto> findAllList(String machineId);
}
